home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1997 February / Macworld (1997-02).dmg / Games World / For Doom⁄Hexen / Hexen / Cannons / CANNONS.ACS next >
Text File  |  1996-01-08  |  32KB  |  1,271 lines

  1. /*
  2.    CANNONS Script,   Written by Brit Willoughby (12-25-95)
  3.  
  4.        Scripts that run the 4 cannons, moves the platforms up and down,
  5.    and change the missles that the cannons fire. The missles are cool!
  6.  
  7.        Scripts that also runs the digital displays! Really cool!
  8.  
  9.        Each player has a seperate script to keep one players delays from
  10.    effecting the other players. I think it's the only way to get it to
  11.    work right. You can change the defines to suit your needs. :)
  12. */
  13.  
  14. #include "common.acs"
  15.  
  16. /* SWITCH DEFINITIONS */
  17. #define FIRE  0
  18. #define HZ_UP 1
  19. #define HZ_DN 2
  20. #define VT_UP 3
  21. #define VT_DN 4
  22. #define SP_UP 5
  23. #define SP_DN 6
  24. #define OBJ   7
  25. #define PL_UP 8
  26. #define PL_DN 9
  27.  
  28. /* PLATFORM DIRECTIONS */
  29. #define UP   1
  30. #define STOP 0
  31. #define DN  -1
  32.  
  33. /* WIND VARIANCE  Slop, either + or - degrees offset (min is 0) */
  34. #define VARIANCE 4  /* NOTE: Too small, you can't hit target, I like 2-4.  */
  35.  
  36. /* SHOTS FIRED  Shots at once, shoots them in a spread (based on variance)!  */
  37. #define MAX_SHOTS 10  /* NOTE: Too small, easy to dodge, I like 8-12.  */
  38.  
  39. /* DELAYS */
  40. #define SECONDS 35       /* Used for "delay(2*SECONDS);" = delay(2*35); */
  41. #define TIME_DELAY 1     /* Small delay for sounds */
  42. #define FIRE_DELAY 2     /* 2 Second delay between shots */
  43. #define BUTTON_DELAY 8   /* Delay between button pushes */
  44. #define DISPLAY_DELAY 4  /* Delay between changing digits */
  45.  
  46. /* PLATFORM VARIABLES */
  47. #define MAX_PLAT 1536     /* Max height platform can goto. */
  48. #define MIN_PLAT 0        /* Min height platform can goto. */
  49. #define PLAT_INC 128      /* How far platform moves per push */
  50. #define PLAT_SPEED 4      /* Speed platform moves up and down */
  51. #define PLAT_WAIT 5       /* How long you got to wait for platform to reset */
  52. #define START_HEIGHT 1024 /* Starting height of platform */
  53.  
  54. /* MISC DEFINES */
  55. #define MAX_ANGLE 90      /* Maximum up velocity */
  56. #define MIN_ANGLE 3       /* Minimum down velocity */
  57. #define MAX_SPEED 99      /* Fastest you can shoot an object */
  58. #define MIN_SPEED 20      /* Slowest you can shoot an object */
  59.  
  60. /* DISPLAY DEFINES */
  61. #define HORIZONTAL 1
  62. #define VERTICAL   2
  63. #define SPEED      3
  64.  
  65. /* CANNON VARIABLES */
  66. int P1_Shooting,P1_Moving,P1_Speed,P1_Horz,P1_Vert,P1_Bull,P1_Height,P1_Angle;
  67. int P2_Shooting,P2_Moving,P2_Speed,P2_Horz,P2_Vert,P2_Bull,P2_Height,P2_Angle;
  68. int P3_Shooting,P3_Moving,P3_Speed,P3_Horz,P3_Vert,P3_Bull,P3_Height,P3_Angle;
  69. int P4_Shooting,P4_Moving,P4_Speed,P4_Horz,P4_Vert,P4_Bull,P4_Height,P4_Angle;
  70.  
  71. /* FOUND A WAY TO GET MORE VARIABLES. DECLARE THEM AS 'WORLD'! :) " */
  72. world int 1:DigitBusy1,2:DigitBusy2,3:DigitBusy3,4:DigitBusy4; 
  73.  
  74. script 0 OPEN
  75. {
  76. int SecTag,Z;
  77.  
  78.     delay(1*SECONDS);
  79.  
  80.     printbold(s:"LET THE SLAUGHTER BEGIN!");
  81.     P1_Height=START_HEIGHT;
  82.     P2_Height=START_HEIGHT;
  83.     P3_Height=START_HEIGHT;
  84.     P4_Height=START_HEIGHT;
  85.  
  86.     /* SET PLATFORMS AT RANDOM HEIGHTS */
  87.     SecTag=1;
  88.     while(SecTag!=5)
  89.     {
  90.         Z=random(0,4)*PLAT_INC;
  91.         if(random(1,100)>50)
  92.         {
  93.             Floor_RaiseByValue(SecTag,64,Z);
  94.         }
  95.         else
  96.         {
  97.             Floor_LowerByValue(SecTag,64,Z);
  98.             Z=-Z;
  99.         }
  100.  
  101.         /* UPDATE THE PLAYERS REAL HEIGHT */     
  102.         switch(SecTag)
  103.         {
  104.             case 1:
  105.             {
  106.                 P1_Height=P1_Height+Z;
  107.                 break;
  108.             }
  109.             case 2:
  110.             {
  111.                 P2_Height=P2_Height+Z;
  112.                 break;
  113.             }
  114.             case 3:
  115.             {
  116.                 P3_Height=P3_Height+Z;
  117.                 break;
  118.             }
  119.             case 4:
  120.             {
  121.                 P4_Height=P4_Height+Z;
  122.                 break;
  123.             }
  124.         }
  125.         SecTag++;
  126.     }
  127.  
  128.     delay(2*SECONDS);
  129.  
  130.     /* RANDOMIZE INITIAL CANNON STATS */
  131.     P1_Speed=random(20,126);
  132.     P1_Horz=random(0,122);
  133.     P1_Vert=random(10,42);
  134.     P1_Bull=T_FIREBALL1;
  135.     P1_Angle=122-P1_Horz;
  136.     P2_Speed=random(20,126);
  137.     P2_Horz=random(70,250);
  138.     P2_Vert=random(10,42);
  139.     P2_Bull=T_FIREBALL1;
  140.     P2_Angle=250-P2_Horz;
  141.     P3_Speed=random(20,126);
  142.     P3_Horz=random(134,255);
  143.     P3_Vert=random(10,42);
  144.     P3_Bull=T_FIREBALL1;
  145.     P3_Angle=314-P3_Horz;
  146.     P4_Speed=random(20,126);
  147.     P4_Horz=random(6,186);
  148.     P4_Vert=random(10,42);
  149.     P4_Bull=T_FIREBALL1;
  150.     P4_Angle=186-P4_Horz;
  151.  
  152.     delay(1* SECONDS);
  153.  
  154.     /* Initialize the digital displays */
  155.     ACS_Execute(241,1,HORIZONTAL,0,0);
  156.     delay(DISPLAY_DELAY);
  157.     ACS_Execute(241,1,VERTICAL,0,0);
  158.     delay(DISPLAY_DELAY);
  159.     ACS_Execute(241,1,SPEED,0,0);
  160.     delay(DISPLAY_DELAY);
  161.     ACS_Execute(242,1,HORIZONTAL,0,0);
  162.     delay(DISPLAY_DELAY);
  163.     ACS_Execute(242,1,VERTICAL,0,0);
  164.     delay(DISPLAY_DELAY);
  165.     ACS_Execute(242,1,SPEED,0,0);
  166.     delay(DISPLAY_DELAY);
  167.     ACS_Execute(243,1,HORIZONTAL,0,0);
  168.     delay(DISPLAY_DELAY);
  169.     ACS_Execute(243,1,VERTICAL,0,0);
  170.     delay(DISPLAY_DELAY);
  171.     ACS_Execute(243,1,SPEED,0,0);
  172.     delay(DISPLAY_DELAY);
  173.     ACS_Execute(244,1,HORIZONTAL,0,0);
  174.     delay(DISPLAY_DELAY);
  175.     ACS_Execute(244,1,VERTICAL,0,0);
  176.     delay(DISPLAY_DELAY);
  177.     ACS_Execute(244,1,SPEED,0,0);
  178.  
  179.     delay(1*SECONDS);
  180.     terminate;
  181. }
  182.  
  183. /* PLAYER 1 ANGLES OF FIRE ARE 0-96 & 224-255 */
  184. script 1 (int P1_Switch)
  185. {
  186. int Var,NewHorz,Shots;
  187.  
  188.     switch(P1_Switch)
  189.     {
  190.         case FIRE:
  191.         {
  192.             if(P1_Shooting==0)
  193.             {
  194.                 P1_Shooting=1;
  195.                 thingsound(1,"FireDemonAttack",127);
  196.  
  197.                 while(Shots<MAX_SHOTS)
  198.                 {
  199.                     /* ALLOW FOR VARIANCE RANDOM ERRORS */
  200.                     Var=random(0,VARIANCE);
  201.                     if(random(1,100)>50)
  202.                         Var=-Var;
  203.                     NewHorz=P1_Horz+Var;
  204.                     if(NewHorz>255)
  205.                         NewHorz=NewHorz-256;
  206.                     if(NewHorz<0)
  207.                         NewHorz=NewHorz+256;
  208.                     delay(TIME_DELAY);
  209.  
  210.                     /* FIRE THAT SUCKER OFF! */
  211.                         Thing_ProjectileGravity(1,P1_Bull,NewHorz,P1_Speed*2,P1_Vert*2);
  212.                     Shots++;
  213.                 }
  214.  
  215.                 delay(FIRE_DELAY*SECONDS);        
  216.                 P1_Shooting=0;
  217.                 terminate;
  218.             }
  219.             break;
  220.         }
  221.         case HZ_UP:
  222.         {
  223.             if(P1_Horz<122)
  224.             {
  225.                 P1_Horz++;
  226.                 P1_Angle--;
  227.                 ACS_Execute(241,1,HORIZONTAL,0,0);
  228.             }
  229.             else
  230.             {
  231.                 if(P1_Horz!=122)
  232.                 {
  233.                     P1_Horz++;
  234.                     P1_Angle--;
  235.                     if(P1_Horz>255)
  236.                     {
  237.                         P1_Horz=0;
  238.                     }
  239.                     ACS_Execute(241,1,HORIZONTAL,0,0);
  240.                 }
  241.             }
  242.             break;
  243.         }
  244.         case HZ_DN:
  245.         {
  246.             if(P1_Horz>198)
  247.             {
  248.                 P1_Horz--;
  249.                 P1_Angle++;
  250.                 ACS_Execute(241,1,HORIZONTAL,0,0);
  251.             }
  252.             else
  253.             {
  254.                 if(P1_Horz!=198)
  255.                 {
  256.                     P1_Horz--;
  257.                     P1_Angle++;
  258.                     if(P1_Horz<0)
  259.                     {
  260.                         P1_Horz=255;
  261.                     }
  262.                     ACS_Execute(241,1,HORIZONTAL,0,0);
  263.                 }
  264.             }
  265.             break;
  266.         }
  267.         case VT_UP:
  268.         {
  269.             if(P1_Vert<MAX_ANGLE)
  270.             {
  271.                 P1_Vert++;
  272.                 ACS_Execute(241,1,VERTICAL,0,0);
  273.             }
  274.             break;
  275.         }
  276.         case VT_DN:
  277.         {
  278.             if(P1_Vert>MIN_ANGLE)
  279.             {
  280.                 P1_Vert--;
  281.                 ACS_Execute(241,1,VERTICAL,0,0);
  282.             }
  283.             break;
  284.         }
  285.         case SP_UP:
  286.         {
  287.             if(P1_Speed<MAX_SPEED)
  288.             {
  289.                 P1_Speed++;
  290.                 ACS_Execute(241,1,SPEED,0,0);
  291.             }
  292.             break;
  293.         }
  294.         case SP_DN:
  295.         {
  296.             if(P1_Speed>MIN_SPEED)
  297.             {
  298.                 P1_Speed--;
  299.                 ACS_Execute(241,1,SPEED,0,0);
  300.             }
  301.             break;
  302.         }
  303.         case OBJ:   
  304.         {
  305.             if(P1_Bull==T_RIPPERBALL)
  306.             {
  307.                 P1_Bull=T_FIREBALL1;
  308.                 break;
  309.             }
  310.             if(P1_Bull==T_FIREBALL1)
  311.             {
  312.                 P1_Bull=T_POISONDART;
  313.                 break;
  314.             }
  315.             if(P1_Bull==T_POISONDART)
  316.             {
  317.                 P1_Bull=T_BLADE;
  318.                 break;
  319.             }
  320.             if(P1_Bull==T_BLADE)
  321.             {
  322.                 P1_Bull=T_ARROW;
  323.                 break;
  324.             }
  325.             if(P1_Bull==T_ARROW)
  326.             {
  327.                 P1_Bull=T_ICESHARD;
  328.                 break;
  329.             }
  330.             if(P1_Bull==T_ICESHARD)
  331.             {
  332.                 P1_Bull=T_MORPHBLAST;
  333.                 break;
  334.             }
  335.             if(P1_Bull==T_MORPHBLAST)
  336.             {
  337.                 P1_Bull=T_RIPPERBALL;
  338.                 break;
  339.             }
  340.         }
  341.         case PL_UP:
  342.         {
  343.             if(P1_Moving==0)
  344.             {
  345.                 P1_Moving=1;
  346.                 ACS_Execute(251,1,UP,0,0);
  347.             }    
  348.             break;
  349.         }
  350.         case PL_DN:
  351.         {
  352.             if(P1_Moving==0)
  353.             {
  354.                 P1_Moving=1;
  355.                 ACS_Execute(251,1,DN,0,0);
  356.             }
  357.             break;
  358.         }
  359.     }
  360. /*print(s:"P1) ROT:",d:P1_Horz,s:" ALT:",d:P1_Vert,s:" VEL:",d:P1_Speed);*/
  361.     delay(BUTTON_DELAY);
  362.     terminate;
  363. }
  364.  
  365. /* PLAYER 2 ANGLES OF FIRE ARE 96-224 */
  366. script 2 (int P2_Switch)
  367. {
  368. int Var,NewHorz,Shots;
  369.  
  370.     switch(P2_Switch)
  371.     {
  372.         case FIRE:
  373.         {
  374.             if(P2_Shooting==0)
  375.             {
  376.                 P2_Shooting=1;
  377.                 thingsound(2,"FireDemonAttack",127);
  378.  
  379.                 while(Shots<MAX_SHOTS)
  380.                 {
  381.                     /* ALLOW FOR SMALL RANDOM ERRORS */
  382.                     Var=random(0,VARIANCE);
  383.                     if(random(1,100)>50)
  384.                         Var=-Var;
  385.                     NewHorz=P2_Horz+Var;
  386.                     delay(TIME_DELAY);
  387.  
  388.                     /* FIRE THAT SUCKER OFF! */
  389.                     Thing_ProjectileGravity(2,P2_Bull,NewHorz,P2_Speed*2,P2_Vert*2);
  390.                     Shots++;
  391.                 }
  392.  
  393.                 delay(FIRE_DELAY*SECONDS);              
  394.                 P2_Shooting=0;
  395.                 terminate;
  396.             }
  397.             break;
  398.         }
  399.         case HZ_UP:
  400.         {
  401.             if(P2_Horz<250)
  402.             {
  403.                 P2_Horz++;
  404.                 P2_Angle--;
  405.                 ACS_Execute(242,1,HORIZONTAL,0,0);
  406.             }
  407.             break;
  408.         }
  409.         case HZ_DN:
  410.         {
  411.             if(P2_Horz>70)
  412.             {
  413.                 P2_Horz--;
  414.                 P2_Angle++;
  415.                 ACS_Execute(242,1,HORIZONTAL,0,0);
  416.             }
  417.             break;
  418.         }
  419.         case VT_UP:
  420.         {
  421.             if(P2_Vert<MAX_ANGLE)
  422.             {
  423.                 P2_Vert++;
  424.                 ACS_Execute(242,1,VERTICAL,0,0);
  425.             }
  426.             break;
  427.         }
  428.         case VT_DN:
  429.         {
  430.             if(P2_Vert>MIN_ANGLE)
  431.             {
  432.                 P2_Vert--;
  433.                 ACS_Execute(242,1,VERTICAL,0,0);
  434.             }
  435.             break;
  436.         }
  437.         case SP_UP:
  438.         {
  439.             if(P2_Speed<MAX_SPEED)
  440.             {
  441.                 P2_Speed++;
  442.                 ACS_Execute(242,1,SPEED,0,0);
  443.             }
  444.             break;
  445.         }
  446.         case SP_DN:
  447.         {
  448.             if(P2_Speed>MIN_SPEED)
  449.             {
  450.                 P2_Speed--;
  451.                 ACS_Execute(242,1,SPEED,0,0);
  452.             }
  453.             break;
  454.         }
  455.         case OBJ:
  456.         {
  457.             if(P2_Bull==T_RIPPERBALL)
  458.             {
  459.                 P2_Bull=T_FIREBALL1;
  460.                 break;
  461.             }
  462.             if(P2_Bull==T_FIREBALL1)
  463.             {
  464.                 P2_Bull=T_POISONDART;
  465.                 break;
  466.             }
  467.             if(P2_Bull==T_POISONDART)
  468.             {
  469.                 P2_Bull=T_BLADE;
  470.                 break;
  471.             }
  472.             if(P2_Bull==T_BLADE)
  473.             {
  474.                 P2_Bull=T_ARROW;
  475.                 break;
  476.             }
  477.             if(P2_Bull==T_ARROW)
  478.             {
  479.                 P2_Bull=T_ICESHARD;
  480.                 break;
  481.             }
  482.             if(P2_Bull==T_ICESHARD)
  483.             {
  484.                 P2_Bull=T_MORPHBLAST;
  485.                 break;
  486.             }
  487.             if(P2_Bull==T_MORPHBLAST)
  488.             {
  489.                 P2_Bull=T_RIPPERBALL;
  490.                 break;
  491.             }
  492.         }
  493.         case PL_UP:
  494.         {
  495.             if(P2_Moving==0)
  496.             {
  497.                 P2_Moving=1;
  498.                 ACS_Execute(252,1,UP,0,0);
  499.             }
  500.             break;
  501.         }
  502.         case PL_DN:
  503.         {
  504.             if(P2_Moving==0)
  505.             {
  506.                 P2_Moving=1;
  507.                 ACS_Execute(252,1,DN,0,0);
  508.             }
  509.             break;
  510.         }
  511.     }
  512. /*print(s:"P2) ROT:",d:P2_Horz,s:" ALT:",d:P2_Vert,s:" VEL:",d:P2_Speed);*/
  513.     delay(BUTTON_DELAY);
  514.     terminate;
  515. }
  516.  
  517. /* PLAYER 3 ANGLES OF FIRE ARE 0-32 & 160-255 */
  518. script 3 (int P3_Switch)
  519. {
  520. int Var,NewHorz,Shots;
  521.  
  522.     switch(P3_Switch)
  523.     {
  524.         case FIRE:
  525.         {
  526.             if(P3_Shooting==0)
  527.             {
  528.                 P3_Shooting=1;
  529.                 thingsound(3,"FireDemonAttack",127);
  530.  
  531.                 while(Shots<MAX_SHOTS)
  532.                 {
  533.                     /* ALLOW FOR VARIANCE RANDOM ERRORS */
  534.                     Var=random(0,VARIANCE);
  535.                     if(random(1,100)>50)
  536.                         Var=-Var;
  537.                     NewHorz=P3_Horz+Var;
  538.                     if(NewHorz>255)
  539.                         NewHorz=NewHorz-256;
  540.                     if(NewHorz<0)
  541.                         NewHorz=NewHorz+256;
  542.                     delay(TIME_DELAY);
  543.  
  544.                     /* FIRE THAT SUCKER OFF! */
  545.                     Thing_ProjectileGravity(3,P3_Bull,NewHorz,P3_Speed*2,P3_Vert*2);
  546.                     Shots++;
  547.                 }
  548.  
  549.                 delay(FIRE_DELAY*SECONDS);        
  550.                 P3_Shooting=0;
  551.                 terminate;
  552.             }
  553.             break;
  554.         }
  555.         case HZ_UP:
  556.         {
  557.             if(P3_Horz<58)
  558.             {
  559.                 P3_Horz++;
  560.                 P3_Angle--;
  561.                 ACS_Execute(243,1,HORIZONTAL,0,0);
  562.             }
  563.             else
  564.             {
  565.                 if(P3_Horz!=58)
  566.                 {
  567.                     P3_Horz++;
  568.                     P3_Angle--;
  569.                     if(P3_Horz>255)
  570.                     {
  571.                         P3_Horz=0;
  572.                     }
  573.                     ACS_Execute(243,1,HORIZONTAL,0,0);
  574.                 }
  575.             }
  576.             break;
  577.         }
  578.         case HZ_DN:
  579.         {
  580.             if(P3_Horz>134)
  581.             {
  582.                 P3_Horz--;
  583.                 P3_Angle++;
  584.                 ACS_Execute(243,1,HORIZONTAL,0,0);
  585.             }
  586.             else
  587.             {
  588.                 if(P3_Horz!=134)
  589.                 {
  590.                     P3_Horz--;
  591.                     P3_Angle++;
  592.                     if(P3_Horz<0)
  593.                     {
  594.                         P3_Horz=255;
  595.                     }
  596.                     ACS_Execute(243,1,HORIZONTAL,0,0);
  597.                 }
  598.             }
  599.             break;
  600.         }
  601.         case VT_UP:
  602.         {
  603.             if(P3_Vert<MAX_ANGLE)
  604.             {
  605.                 P3_Vert++;
  606.                 ACS_Execute(243,1,VERTICAL,0,0);
  607.             }
  608.             break;
  609.         }
  610.         case VT_DN:
  611.         {
  612.             if(P3_Vert>MIN_ANGLE)
  613.             {
  614.                 P3_Vert--;
  615.                 ACS_Execute(243,1,VERTICAL,0,0);
  616.             }
  617.             break;
  618.         }
  619.         case SP_UP:
  620.         {
  621.             if(P3_Speed<MAX_SPEED)
  622.             {
  623.                 P3_Speed++;
  624.                 ACS_Execute(243,1,SPEED,0,0);
  625.             }
  626.             break;
  627.         }
  628.         case SP_DN:
  629.         {
  630.             if(P3_Speed>MIN_SPEED)
  631.             {
  632.                 P3_Speed--;
  633.                 ACS_Execute(243,1,SPEED,0,0);
  634.             }
  635.             break;
  636.         }
  637.         case OBJ:
  638.         {
  639.             if(P3_Bull==T_RIPPERBALL)
  640.             {
  641.                 P3_Bull=T_FIREBALL1;
  642.                 break;
  643.             }
  644.             if(P3_Bull==T_FIREBALL1)
  645.             {
  646.                 P3_Bull=T_POISONDART;
  647.                 break;
  648.             }
  649.             if(P3_Bull==T_POISONDART)
  650.             {
  651.                 P3_Bull=T_BLADE;
  652.                 break;
  653.             }
  654.             if(P3_Bull==T_BLADE)
  655.             {
  656.                 P3_Bull=T_ARROW;
  657.                 break;
  658.             }
  659.             if(P3_Bull==T_ARROW)
  660.             {
  661.                 P3_Bull=T_ICESHARD;
  662.                 break;
  663.             }
  664.             if(P3_Bull==T_ICESHARD)
  665.             {
  666.                 P3_Bull=T_MORPHBLAST;
  667.                 break;
  668.             }
  669.             if(P3_Bull==T_MORPHBLAST)
  670.             {
  671.                 P3_Bull=T_RIPPERBALL;
  672.                 break;
  673.             }
  674.         }
  675.         case PL_UP:
  676.         {
  677.             if(P3_Moving==0)
  678.             {
  679.                 P3_Moving=1;
  680.                 ACS_Execute(253,1,UP,0,0);
  681.             }
  682.             break;
  683.         }
  684.         case PL_DN:
  685.         {
  686.             if(P3_Moving==0)
  687.             {
  688.                 P3_Moving=1;            
  689.                 ACS_Execute(253,1,DN,0,0);
  690.             }
  691.             break;
  692.         }
  693.     }
  694. /*print(s:"P3) ROT:",d:P3_Horz,s:" ALT:",d:P3_Vert,s:" VEL:",d:P3_Speed);*/
  695.     delay(BUTTON_DELAY);
  696.     terminate;
  697. }
  698.  
  699. /* PLAYER 4 ANGLES OF FIRE ARE 32-160 */
  700. script 4 (int P4_Switch)
  701. {
  702. int Var,NewHorz,Shots;
  703.  
  704.     switch(P4_Switch)
  705.     {
  706.         case FIRE:
  707.         {
  708.             if(P4_Shooting==0)
  709.             {    
  710.                 P4_Shooting=1;
  711.                 thingsound(4,"FireDemonAttack",127);
  712.  
  713.                 while(Shots<MAX_SHOTS)
  714.                 {
  715.                     /* ALLOW FOR VARIANCE RANDOM ERRORS */
  716.                     Var=random(0,VARIANCE);
  717.                     if(random(1,100)>50)
  718.                         Var=-Var;
  719.                     NewHorz=P4_Horz+Var;
  720.                     delay(TIME_DELAY);
  721.  
  722.                     /* FIRE THAT SUCKER OFF! */
  723.                     Thing_ProjectileGravity(4,P4_Bull,NewHorz,P4_Speed*2,P4_Vert*2);
  724.                     Shots++;
  725.                 }
  726.  
  727.                 delay(FIRE_DELAY*SECONDS);
  728.                 P4_Shooting=0;
  729.                 terminate;
  730.             }
  731.             break;
  732.         }
  733.         case HZ_UP:
  734.         {
  735.             if(P4_Horz<186)
  736.             {
  737.                 P4_Horz++;
  738.                 P4_Angle--;
  739.                 ACS_Execute(244,1,HORIZONTAL,0,0);
  740.             }
  741.             break;
  742.         }
  743.         case HZ_DN:
  744.         {
  745.             if(P4_Horz>6)
  746.             {
  747.                 P4_Horz--;
  748.                 P4_Angle++;
  749.                 ACS_Execute(244,1,HORIZONTAL,0,0);
  750.             }
  751.             break;
  752.         }
  753.         case VT_UP:
  754.         {
  755.             if(P4_Vert<MAX_ANGLE)
  756.             {
  757.                 P4_Vert++;
  758.                 ACS_Execute(244,1,VERTICAL,0,0);
  759.             }
  760.             break;
  761.         }
  762.         case VT_DN:
  763.         {
  764.             if(P4_Vert>MIN_ANGLE)
  765.             {
  766.                 P4_Vert--;
  767.                 ACS_Execute(244,1,VERTICAL,0,0);
  768.             }
  769.             break;
  770.         }
  771.         case SP_UP:
  772.         {
  773.             if(P4_Speed<MAX_SPEED)
  774.             {
  775.                 P4_Speed++;
  776.                 ACS_Execute(244,1,SPEED,0,0);
  777.             }
  778.              break;
  779.         }
  780.         case SP_DN:
  781.         {
  782.             if(P4_Speed>MIN_SPEED)
  783.             {
  784.                 P4_Speed--;
  785.                 ACS_Execute(244,1,SPEED,0,0);
  786.             }
  787.             break;
  788.         }
  789.         case OBJ:
  790.         {
  791.             if(P4_Bull==T_RIPPERBALL)
  792.             {
  793.                 P4_Bull=T_FIREBALL1;
  794.                 break;
  795.             }
  796.             if(P4_Bull==T_FIREBALL1)
  797.             {
  798.                 P4_Bull=T_POISONDART;
  799.                 break;
  800.             }
  801.             if(P4_Bull==T_POISONDART)
  802.             {
  803.                 P4_Bull=T_BLADE;
  804.                 break;
  805.             }
  806.             if(P4_Bull==T_BLADE)
  807.             {
  808.                 P4_Bull=T_ARROW;
  809.                 break;
  810.             }
  811.             if(P4_Bull==T_ARROW)
  812.             {
  813.                 P4_Bull=T_ICESHARD;
  814.                 break;
  815.             }
  816.             if(P4_Bull==T_ICESHARD)
  817.             {
  818.                 P4_Bull=T_MORPHBLAST;
  819.                 break;
  820.             }
  821.             if(P4_Bull==T_MORPHBLAST)
  822.             {
  823.                 P4_Bull=T_RIPPERBALL;
  824.                 break;
  825.             }
  826.         }
  827.         case PL_UP:
  828.         {
  829.             if(P4_Moving==0)
  830.             {
  831.                 P4_Moving=1;
  832.                 ACS_Execute(254,1,UP,0,0);
  833.             }
  834.             break;
  835.         }
  836.         case PL_DN:
  837.         {
  838.             if(P4_Moving==0)
  839.             {
  840.                 P4_Moving=1;
  841.                 ACS_Execute(254,1,DN,0,0);
  842.             }
  843.             break;
  844.         }
  845.     }
  846. /*print(s:"P4) ROT:",d:P4_Horz,s:" ALT:",d:P4_Vert,s:" VEL:",d:P4_Speed);*/
  847.     delay(BUTTON_DELAY);
  848.     terminate;
  849. }
  850.  
  851. /* Runs the digital display to display numbers from 0-999 */
  852. script 241 (int Display)
  853. {
  854.     switch(Display)
  855.     {
  856.         case HORIZONTAL:
  857.         {
  858. print(d:P1_Angle);
  859.             if(DigitBusy1==1)
  860.                 scriptwait(246);
  861.             ACS_Execute(246,1,3,P1_Angle%10,0);
  862.             scriptwait(246);
  863.             ACS_Execute(246,1,2,(P1_Angle/10)%10,0);
  864.             scriptwait(246);
  865.             ACS_Execute(246,1,1,P1_Angle/100,0);
  866.             scriptwait(246);
  867.             break;
  868.         }
  869.         case VERTICAL:
  870.         {
  871.             if(DigitBusy1==1)     
  872.                 scriptwait(246);
  873.             ACS_Execute(246,1,7,P1_Vert%10,0);
  874.             scriptwait(246);
  875.             ACS_Execute(246,1,6,P1_Vert/10,0);
  876.             scriptwait(246);
  877.             break;
  878.         }
  879.         case SPEED:
  880.         {
  881.             if(DigitBusy1==1)    
  882.                 scriptwait(246);
  883.             ACS_Execute(246,1,5,P1_Speed%10,0);
  884.             scriptwait(246);
  885.             ACS_Execute(246,1,4,P1_Speed/10,0);
  886.             scriptwait(246);
  887.             break;
  888.         }
  889.     }
  890.     terminate;
  891. }
  892. script 242 (int Display)
  893. {
  894.     switch(Display)
  895.     {
  896.         case HORIZONTAL:
  897.         {
  898.             if(DigitBusy2==1)     
  899.                 scriptwait(247);
  900.             ACS_Execute(247,1,10,P2_Angle%10,0);
  901.             scriptwait(247);
  902.             ACS_Execute(247,1,9,(P2_Angle/10)%10,0);
  903.             scriptwait(247);
  904.             ACS_Execute(247,1,8,P2_Angle/100,0);
  905.             scriptwait(247);
  906.             break;
  907.         }
  908.         case VERTICAL:
  909.         {
  910.             if(DigitBusy2==1)   
  911.                 scriptwait(247);
  912.             ACS_Execute(247,1,14,P2_Vert%10,0);
  913.             scriptwait(247);
  914.             ACS_Execute(247,1,13,P2_Vert/10,0);
  915.             scriptwait(247);
  916.             break;
  917.         }
  918.         case SPEED:
  919.         {
  920.             if(DigitBusy2==1)    
  921.                 scriptwait(247);
  922.             ACS_Execute(247,1,12,P2_Speed%10,0);
  923.             scriptwait(247);
  924.             ACS_Execute(247,1,11,P2_Speed/10,0);
  925.             scriptwait(247);
  926.             break;
  927.         }
  928.     }
  929.     terminate;
  930. }
  931. script 243 (int Display)
  932. {
  933.     switch(Display)
  934.     {
  935.         case HORIZONTAL:
  936.         {
  937.             if(DigitBusy3==1)        
  938.                 scriptwait(248);
  939.             ACS_Execute(248,1,17,P3_Angle%10,0);
  940.             scriptwait(248);
  941.             ACS_Execute(248,1,16,(P3_Angle/10)%10,0);
  942.             scriptwait(248);
  943.             ACS_Execute(248,1,15,P3_Angle/100,0);
  944.             scriptwait(248);
  945.             break;
  946.         }
  947.         case VERTICAL:
  948.         {
  949.             if(DigitBusy3==1)     
  950.                 scriptwait(248);
  951.             ACS_Execute(248,1,21,P3_Vert%10,0);
  952.             scriptwait(248);
  953.             ACS_Execute(248,1,20,P3_Vert/10,0);
  954.             scriptwait(248);
  955.             break;
  956.         }
  957.         case SPEED:
  958.         {
  959.             if(DigitBusy3==1)  
  960.                 scriptwait(248);
  961.             ACS_Execute(248,1,19,P3_Speed%10,0);
  962.             scriptwait(248);
  963.             ACS_Execute(248,1,18,P3_Speed/10,0);
  964.             scriptwait(248);
  965.             break;
  966.         }
  967.     }
  968.     terminate;
  969. }
  970. script 244 (int Display)
  971. {
  972.     switch(Display)
  973.     {
  974.         case HORIZONTAL:
  975.         {
  976.             if(DigitBusy4==1)   
  977.                 scriptwait(249);
  978.             ACS_Execute(249,1,24,P4_Angle%10,0);
  979.             scriptwait(249);
  980.             ACS_Execute(249,1,23,(P4_Angle/10)%10,0);
  981.             scriptwait(249);
  982.             ACS_Execute(249,1,22,P4_Angle/100,0);
  983.             scriptwait(249);
  984.             break;
  985.         }
  986.         case VERTICAL:
  987.         {
  988.             if(DigitBusy4==1)     
  989.                 scriptwait(249);
  990.             ACS_Execute(249,1,28,P4_Vert%10,0);
  991.             scriptwait(249);
  992.             ACS_Execute(249,1,27,P4_Vert/10,0);
  993.             scriptwait(249);
  994.             break;
  995.         }
  996.         case SPEED:
  997.         {
  998.             if(DigitBusy4==1)    
  999.                 scriptwait(249);
  1000.             ACS_Execute(249,1,26,P4_Speed%10,0);
  1001.             scriptwait(249);
  1002.             ACS_Execute(249,1,25,P4_Speed/10,0);
  1003.             scriptwait(249);
  1004.             break;
  1005.         }
  1006.     }
  1007.     terminate;
  1008. }
  1009.  
  1010. /* CHANGES THE TEXTURE TO THE PROPER NUMBER */
  1011. script 246 (int Line,int Digit)
  1012. {
  1013.     DigitBusy1=1;   
  1014.     switch(Digit)
  1015.     {
  1016.         case 0:
  1017.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer01");
  1018.             break;
  1019.         case 1:
  1020.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer02");
  1021.             break;
  1022.         case 2:
  1023.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer03");
  1024.             break;
  1025.         case 3:
  1026.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer04");
  1027.             break;
  1028.         case 4:
  1029.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer05");
  1030.             break;
  1031.         case 5:
  1032.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer06");
  1033.             break;
  1034.         case 6:
  1035.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer07");
  1036.             break;
  1037.         case 7:
  1038.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer08");
  1039.             break;
  1040.         case 8:
  1041.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer09");
  1042.             break;
  1043.         case 9:
  1044.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer10");
  1045.             break;
  1046.     }
  1047.     DigitBusy1=0;  
  1048.     terminate;
  1049. }
  1050. script 247 (int Line,int Digit)
  1051. {
  1052.     DigitBusy2=1;    
  1053.     switch(Digit)
  1054.     {
  1055.         case 0:
  1056.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer01");
  1057.             break;
  1058.         case 1:
  1059.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer02");
  1060.             break;
  1061.         case 2:
  1062.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer03");
  1063.             break;
  1064.         case 3:
  1065.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer04");
  1066.             break;
  1067.         case 4:
  1068.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer05");
  1069.             break;
  1070.         case 5:
  1071.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer06");
  1072.             break;
  1073.         case 6:
  1074.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer07");
  1075.             break;
  1076.         case 7:
  1077.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer08");
  1078.             break;
  1079.         case 8:
  1080.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer09");
  1081.             break;
  1082.         case 9:
  1083.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer10");
  1084.             break;
  1085.     }
  1086.     DigitBusy2=0;   
  1087.     terminate;
  1088. }
  1089.  
  1090. script 248 (int Line,int Digit)
  1091. {
  1092.     DigitBusy3=1;  
  1093.     switch(Digit)
  1094.     {
  1095.         case 0:
  1096.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer01");
  1097.             break;
  1098.         case 1:
  1099.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer02");
  1100.             break;
  1101.         case 2:
  1102.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer03");
  1103.             break;
  1104.         case 3:
  1105.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer04");
  1106.             break;
  1107.         case 4:
  1108.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer05");
  1109.             break;
  1110.         case 5:
  1111.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer06");
  1112.             break;
  1113.         case 6:
  1114.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer07");
  1115.             break;
  1116.         case 7:
  1117.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer08");
  1118.             break;
  1119.         case 8:
  1120.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer09");
  1121.             break;
  1122.         case 9:
  1123.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer10");
  1124.             break;
  1125.     }
  1126.     DigitBusy3=0;  
  1127.     terminate;
  1128. }
  1129.  
  1130. script 249 (int Line,int Digit)
  1131. {
  1132.     DigitBusy4=1;    
  1133.     switch(Digit)
  1134.     {
  1135.         case 0:
  1136.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer01");
  1137.             break;
  1138.         case 1:
  1139.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer02");
  1140.             break;
  1141.         case 2:
  1142.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer03");
  1143.             break;
  1144.         case 3:
  1145.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer04");
  1146.             break;
  1147.         case 4:
  1148.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer05");
  1149.             break;
  1150.         case 5:
  1151.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer06");
  1152.             break;
  1153.         case 6:
  1154.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer07");
  1155.             break;
  1156.         case 7:
  1157.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer08");
  1158.             break;
  1159.         case 8:
  1160.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer09");
  1161.             break;
  1162.         case 9:
  1163.             setlinetexture(Line,SIDE_FRONT,TEXTURE_BOTTOM,"sewer10");
  1164.             break;
  1165.     }
  1166.     DigitBusy4=0;  
  1167.     terminate;
  1168. }
  1169.  
  1170. /* MOVE THE PLATFORMS UP AND DOWN */
  1171. script 251 (int Direction)
  1172. {
  1173.     if(Direction==UP)
  1174.     {
  1175.         if(P1_Height<MAX_PLAT)
  1176.         {
  1177.             P1_Height=P1_Height+PLAT_INC;
  1178.             Floor_RaiseByValue(1,PLAT_SPEED,PLAT_INC);
  1179.             tagwait(1);
  1180.         }
  1181.     }
  1182.     else
  1183.     {
  1184.         if(P1_Height>MIN_PLAT)
  1185.         {
  1186.             P1_Height=P1_Height-PLAT_INC;
  1187.             Floor_LowerByValue(1,PLAT_SPEED,PLAT_INC);
  1188.             tagwait(1);
  1189.         }
  1190.     }
  1191.     delay(PLAT_WAIT*SECONDS);
  1192.     P1_Moving=0;
  1193.     terminate;
  1194. }
  1195.  
  1196. script 252 (int Direction)
  1197. {
  1198.     if(Direction==UP)
  1199.     {
  1200.         if(P2_Height<MAX_PLAT)
  1201.         {
  1202.             P2_Height=P2_Height+PLAT_INC;
  1203.             Floor_RaiseByValue(2,PLAT_SPEED,PLAT_INC);
  1204.             tagwait(2);
  1205.         }
  1206.     }
  1207.     else
  1208.     {
  1209.         if(P2_Height>MIN_PLAT)
  1210.         {
  1211.             P2_Height=P2_Height-PLAT_INC;
  1212.             Floor_LowerByValue(2,PLAT_SPEED,PLAT_INC);
  1213.             tagwait(2);
  1214.         }
  1215.     }
  1216.     delay(PLAT_WAIT*SECONDS);
  1217.     P2_Moving=0;
  1218.     terminate;
  1219. }
  1220.  
  1221. script 253 (int Direction)
  1222. {
  1223.     if(Direction==UP)
  1224.     {
  1225.         if(P3_Height<MAX_PLAT)
  1226.         {
  1227.             P3_Height=P3_Height+PLAT_INC;
  1228.             Floor_RaiseByValue(3,PLAT_SPEED,PLAT_INC);
  1229.             tagwait(3);
  1230.         }
  1231.     }
  1232.     else
  1233.     {
  1234.         if(P3_Height>MIN_PLAT)
  1235.         {
  1236.             P3_Height=P3_Height-PLAT_INC;
  1237.             Floor_LowerByValue(3,PLAT_SPEED,PLAT_INC);
  1238.             tagwait(3);
  1239.         }
  1240.     }
  1241.     delay(PLAT_WAIT*SECONDS);
  1242.     P3_Moving=0;
  1243.     terminate;
  1244. }
  1245.  
  1246. script 254 (int Direction)
  1247. {
  1248.     if(Direction==UP)
  1249.     {
  1250.         if(P4_Height<MAX_PLAT)
  1251.         {
  1252.             P4_Height=P4_Height+PLAT_INC;
  1253.             Floor_RaiseByValue(4,PLAT_SPEED,PLAT_INC);
  1254.             tagwait(4);
  1255.         }
  1256.     }
  1257.     else
  1258.     {
  1259.         if(P4_Height>MIN_PLAT)
  1260.         {
  1261.             P4_Height=P4_Height-PLAT_INC;
  1262.             Floor_LowerByValue(4,PLAT_SPEED,PLAT_INC);
  1263.             tagwait(4);
  1264.         }
  1265.     }                              
  1266.     delay(PLAT_WAIT*SECONDS);
  1267.     P4_Moving=0;
  1268.     terminate;
  1269. }
  1270.  
  1271.